class SearchesController < ApplicationController

  def show
    @term = params[:term]

    if @term.nil?
       redirect_to home_path
       return
     end

    @profiles = User.paginate :page => params[:page],
                              :include => [:photo, :current_job],
                              :conditions => User.build_search(@term)

    @disciplines = Discipline.paginate :page => params[:page],
                                       :conditions => Discipline.build_search(@term)

    @articles = Article.paginate :page => params[:page],
                                 :conditions => Article.build_search(@term)

    @discussions = Discussion.paginate :page => params[:page],
                                       :conditions => Discussion.build_search(@term)

  end

end
